﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;

namespace RclSystem
{
    internal static class Program
    {
        public static log4net.ILog logger;
        public static string connectionString = "";
        public static void loadConfig()
        {
            string stringPath;
            XmlDocument xmlDoc;
            XmlNodeList xnl;
            try
            {
                stringPath = Application.StartupPath + "\\wlconfig.xml";

                xmlDoc = new XmlDocument();
                xmlDoc.Load(stringPath);

                xnl = xmlDoc.SelectSingleNode("rclConfig").ChildNodes;
                connectionString = xnl[0].InnerText;
            }
            catch(Exception ex)
            {
                logger.Error("获取数据库连接信息失败");
                logger.Info("Stop init program");
                Environment.Exit(0);
            }

            
            return;



        }
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            //log4net
            log4net.Config.XmlConfigurator.Configure();
            logger = log4net.LogManager.GetLogger(typeof(Program));

            logger.Info("*****   *****   ******  *****");
            logger.Info("*****   *****   ******  *****");
            logger.Info("Start program");

            loadConfig();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainCore());
        }
    }
}
